<?php

namespace app\common\model;

class ResumeCandidate extends \app\common\model\BaseModel {

    protected $insert = [
        'addtime',
        'updatetime'
    ];

    protected $update = ['updatetime'];

    protected function setAddtimeAttr($value = null) {
        return $value === null ? time() : $value;
    }

    protected function setUpdatetimeAttr($value = null) {
        return $value === null ? time() : $value;
    }

    protected $type = [
        'id' => 'integer',
        'company_id' => 'integer',
        'status' => 'integer',
    ];
    public function education()
    {
        return $this->hasMany(ResumeEducation::class,'rid','resume_id');
    }
    public function intention()
    {
        return $this->hasOne(ResumeIntention::class,'rid','resume_id');
    }
    public function work()
    {
        return $this->hasMany(ResumeWork::class,'rid','resume_id');
    }
    public function training()
    {
        return $this->hasMany(ResumeTraining::class,'rid','resume_id');
    }
    public function project()
    {
        return $this->hasMany(ResumeProject::class,'rid','resume_id');
    }
    public function certificate()
    {
        return $this->hasMany(ResumeCertificate::class,'rid','resume_id');
    }
    public function language()
    {
        return $this->hasMany(ResumeLanguage::class,'rid','resume_id');
    }
    public function enclosure()
    {
        return $this->hasOne(ResumeEnclosure::class,'rid','resume_id');
    }
}
